var Client = require("mysql-pro");
require("dotenv").config()
var client = new Client({
    mysql: {
        host: process.env.MYSQL_HOST,
        port: process.env.MYSQL_PORT,
        database: process.env.MYSQL_DB,
        user: process.env.MYSQL_USER,
        password: process.env.MYSQL_PASS
    }
});
exports.execSql = function(sql){
    return new Promise((resolve, reject) => {
        client.query(sql).then(function(result) {
            // use result
            resolve(result)
        }, function(error){
            // error
            reject(error)
        });
    })
}